﻿using Circle.Web.Application.Mvc;
using Circle.Web.Drivers.Contract;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Circle.Website.Controllers
{
    public class UserController : BaseSiteMvcController
    {
        private ITopicDriver _topicDriver;
        private ICommentDriver _commentDriver;

        public UserController(ITopicDriver topicDriver, ICommentDriver commentDriver)
        {
            _topicDriver = topicDriver;
            _commentDriver = commentDriver;
        }

        [HttpGet]
        [AnnaMvcAuthorize]
        public ActionResult Topic(int? pageIndex)
        {
            int index = 0;
            if (pageIndex.HasValue && pageIndex.Value > 0) { index = pageIndex.Value; }
            var pageTopics = _topicDriver.PagingMyClientTopics(index, DefaultSetting.TopicsPerPage, "CreateTime DESC");
            return View(pageTopics);
        }

        [HttpGet]
        [AnnaMvcAuthorize]
        public ActionResult Comment(int? pageIndex)
        {
            int index = 0;
            if (pageIndex.HasValue && pageIndex.Value > 0) { index = pageIndex.Value; }
            var pageComments = _commentDriver.PagingMyClientComments(index, DefaultSetting.CommentsPerPage, "CreateTime DESC");
            return View(pageComments);
        }

        [HttpGet]
        [AnnaMvcAuthorize]
        public ActionResult Setting()
        {
            return View();
        }


    }
}
